{"action":"created","issue":{"url":"https://api.github.com/repos/hashicorp/terraform/issues/4607","labels_url":"https://api.github.com/repos/hashicorp/terraform/issues/4607/labels{/name}","comments_url":"https://api.github.com/repos/hashicorp/terraform/issues/4607/comments","events_url":"https://api.github.com/repos/hashicorp/terraform/issues/4607/events","html_url":"https://github.com/hashicorp/terraform/issues/4607","id":125836974,"number":4607,"title":"aws provider info isn't available to grandchild module in 0.6.9","user":{"login":"WillAbides","id":233500,"avatar_url":"https://avatars.githubusercontent.com/u/233500?v=3","gravatar_id":"","url":"https://api.github.com/users/WillAbides","html_url":"https://github.com/WillAbides","followers_url":"https://api.github.com/users/WillAbides/followers","following_url":"https://api.github.com/users/WillAbides/following{/other_user}","gists_url":"https://api.github.com/users/WillAbides/gists{/gist_id}","starred_url":"https://api.github.com/users/WillAbides/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/WillAbides/subscriptions","organizations_url":"https://api.github.com/users/WillAbides/orgs","repos_url":"https://api.github.com/users/WillAbides/repos","events_url":"https://api.github.com/users/WillAbides/events{/privacy}","received_events_url":"https://api.github.com/users/WillAbides/received_events","type":"User","site_admin":true},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2016-01-10T18:33:16Z","updated_at":"2016-01-12T14:34:37Z","closed_at":null,"body":"I have a module (network_module) that uses another module (key_pair_module) that creates an aws resource.  As of 0.6.8, I could use network_module from a config that has an aws provider defined and the auth and region from that provider was used when key_pair_module created an aws_key_pair.  Now, with 0.6.9, that no longer works.\r\n\r\nHere are some simplified configs that show the problem:\r\n\r\n./key_pair_module/main.tf\r\n```hcl\r\nvariable \"public_key\" {}\r\nvariable \"key_name\" {}\r\n\r\nresource \"aws_key_pair\" \"key\" {\r\n  public_key = \"${var.public_key}\"\r\n  key_name = \"${var.key_name}\"\r\n}\r\n```\r\n\r\n./network_module/main.tf\r\n```hcl\r\nvariable \"aws_public_key_path\" {}\r\nvariable \"key_name\" {}\r\n\r\nmodule \"key_pair\" {\r\n  source = \"../key_pair_module\"\r\n  public_key = \"${file(var.aws_public_key_path)}\"\r\n  key_name = \"${var.key_name}\"\r\n}\r\n```\r\n\r\n./example_config/main.tf\r\n```hcl\r\nvariable \"aws_region\" {\r\n  default = \"us-east-1\"\r\n}\r\nvariable \"aws_access_key\" {}\r\nvariable \"aws_secret_key\" {}\r\n\r\nprovider \"aws\" {\r\n  region = \"${var.aws_region}\"\r\n  access_key = \"${var.aws_access_key}\"\r\n  secret_key = \"${var.aws_secret_key}\"\r\n}\r\n\r\nmodule \"network_module\" {\r\n  source = \"../network_module\"\r\n  aws_public_key_path = \"./id_rsa.pub\"\r\n  key_name = \"test-key-please-ignore\"\r\n}\r\n```\r\n\r\n./example_config/terraform.tfvars\r\n```\r\naws_access_key = \"SSSHHHHH\"\r\naws_secret_key = \"ITSASECRET\"\r\n```\r\n\r\nThis is the output when I run terraform apply with 0.6.9:\r\n```console\r\n ~/hack/terraform-grandchild-repro/example_config  $  terraform apply\r\nprovider.aws.region\r\n  The region where AWS operations will take place. Examples\r\n  are us-east-1, us-west-2, etc.\r\n\r\n  Default: us-east-1\r\n  Enter a value:\r\n\r\nError refreshing state: 1 error(s) occurred:\r\n\r\n* 1 error(s) occurred:\r\n\r\n* Error loading credentials for AWS Provider: NoCredentialProviders: no valid providers in chain\r\n```\r\n\r\nIt shouldn't have prompted for provider.aws.region since that was already defined in the aws provider.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/hashicorp/terraform/issues/comments/170929445","html_url":"https://github.com/hashicorp/terraform/issues/4607#issuecomment-170929445","issue_url":"https://api.github.com/repos/hashicorp/terraform/issues/4607","id":170929445,"user":{"login":"WillAbides","id":233500,"avatar_url":"https://avatars.githubusercontent.com/u/233500?v=3","gravatar_id":"","url":"https://api.github.com/users/WillAbides","html_url":"https://github.com/WillAbides","followers_url":"https://api.github.com/users/WillAbides/followers","following_url":"https://api.github.com/users/WillAbides/following{/other_user}","gists_url":"https://api.github.com/users/WillAbides/gists{/gist_id}","starred_url":"https://api.github.com/users/WillAbides/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/WillAbides/subscriptions","organizations_url":"https://api.github.com/users/WillAbides/orgs","repos_url":"https://api.github.com/users/WillAbides/repos","events_url":"https://api.github.com/users/WillAbides/events{/privacy}","received_events_url":"https://api.github.com/users/WillAbides/received_events","type":"User","site_admin":true},"created_at":"2016-01-12T14:34:37Z","updated_at":"2016-01-12T14:34:37Z","body":"@wholroyd Thanks. This may be a dupe of #4443, but I'm going to leave it open and let a contributor decide for sure."}}