0
votes

The documentation for google_compute_subnetwork > private_ip_google_access states that private_ip_google_access is an exported attribute as opposed to being an argument which I assume means that it cannot be specified in my terraform code. However, I have just run a successful terraform apply using this terraform HCL code:

resource "google_compute_subnetwork" "subnetwork" {
  name                     = "${var.subnetname}"
  ip_cidr_range            = "${var.subnet_range}"
  network                  = "${var.network}"
  region                   = "${var.region}"
  private_ip_google_access = "true"
}

So one of the following must be true:
* I am misunderstanding what it means to be an attribute. My assumption up to now has been that arguments can be specified, attributes cannot. Am I wrong in this assumption?
* The documentation incorrectly states that private_ip_google_access is an attribute whereas actually it should be an argument.

Which of those is true?

1
The documentation you have linked to here is for a data "google_compute_subnetwork" block, but your configuration is a resource "google_compute_subnetwork" block. The relevant documentation for the resource block contents is here: terraform.io/docs/providers/google/r/compute_subnetwork.htmlMartin Atkins
You are correct, and now I feel suitably embarrassed. Sorry for wasting folks’ time.jamiet

1 Answers

1
votes

You are right in both cases.

A resource has two sets of elements, arguments for input and attribute for output.

In this case, as you are able to set private_ip_google_access when calling the resource, it means that it's actually an argument and not an attribute.