Search code examples
dockergoogle-cloud-platformgcloudterraformgoogle-container-registry

Terraform - GCloud Container Registry Sample


I'm working with terraforming gcloud resources and need to create gcloud container registry and trying to use below sample from terraform.io

data "google_container_registry_repository" {}

output "gcr_location" {
    value = "${data.google_container_registry_repository.repository_url}"
}

and receving below error when I run terraform plan

'data' must be followed by exactly two strings: a type and a name

Any working sample that I can refer to ?

terraform.io syntax : https://www.terraform.io/docs/providers/google/d/google_container_registry_repository.html

terraform version: Terraform v0.11.2

Edit : updated to Terraform v0.11.3 and still same problem.


Solution

  • Try this:

    data "google_container_registry_repository" "myregistry" {}
    
    output "gcr_location" {
        value = "${data.google_container_registry_repository.myregistry.repository_url}"
    }