Last active
April 16, 2019 09:07
-
-
Save xuqingfeng/de5d4abc6f38a78e01c2ed15aab73776 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# inside 'common' folder | |
output "vpc-id" { | |
value = "${alicloud_vpc.default.id}" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# fetch data from common state - https://www.terraform.io/docs/providers/terraform/d/remote_state.html | |
data "terraform_remote_state" "common" { | |
backend = "local" | |
config = { | |
path = "../common/terraform.tfstate" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resource "alicloud_security_group" "db" { | |
name = "${var.db-security-group-name}" | |
vpc_id = "${data.terraform_remote_state.common.vpc-id}" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment