mirror of
https://github.com/letic/terraform-provider-google.git
synced 2024-07-05 17:52:38 +00:00
Fix ci tests
This commit is contained in:
parent
0bed3bd5c7
commit
f85dc70b20
|
@ -673,84 +673,6 @@ resource "google_compute_disk" "foobar" {
|
|||
}
|
||||
}`, diskName)
|
||||
}
|
||||
|
||||
func testAccComputeDisk_encryptionKMS(pid, pname, org, billing, diskName, keyRingName, keyName string) string {
|
||||
return fmt.Sprintf(`
|
||||
resource "google_project" "project" {
|
||||
project_id = "%s"
|
||||
name = "%s"
|
||||
org_id = "%s"
|
||||
billing_account = "%s"
|
||||
}
|
||||
|
||||
data "google_compute_image" "my_image" {
|
||||
family = "debian-9"
|
||||
project = "debian-cloud"
|
||||
}
|
||||
|
||||
resource "google_project_services" "apis" {
|
||||
project = "${google_project.project.project_id}"
|
||||
|
||||
services = [
|
||||
"oslogin.googleapis.com",
|
||||
"compute.googleapis.com",
|
||||
"cloudkms.googleapis.com",
|
||||
"appengine.googleapis.com",
|
||||
]
|
||||
}
|
||||
|
||||
resource "google_project_iam_member" "kms-project-binding" {
|
||||
project = "${google_project.project.project_id}"
|
||||
role = "roles/cloudkms.cryptoKeyEncrypterDecrypter"
|
||||
member = "serviceAccount:service-${google_project.project.number}@compute-system.iam.gserviceaccount.com"
|
||||
|
||||
depends_on = ["google_project_services.apis"]
|
||||
}
|
||||
|
||||
resource "google_kms_crypto_key_iam_binding" "kms-key-binding" {
|
||||
crypto_key_id = "${google_kms_crypto_key.my_crypto_key.self_link}"
|
||||
role = "roles/cloudkms.cryptoKeyEncrypterDecrypter"
|
||||
|
||||
members = [
|
||||
"serviceAccount:service-${google_project.project.number}@compute-system.iam.gserviceaccount.com",
|
||||
]
|
||||
|
||||
depends_on = ["google_project_services.apis"]
|
||||
}
|
||||
|
||||
resource "google_kms_key_ring" "my_key_ring" {
|
||||
name = "%s"
|
||||
project = "${google_project.project.project_id}"
|
||||
location = "us-central1"
|
||||
|
||||
depends_on = ["google_project_services.apis"]
|
||||
}
|
||||
|
||||
resource "google_kms_crypto_key" "my_crypto_key" {
|
||||
name = "%s"
|
||||
key_ring = "${google_kms_key_ring.my_key_ring.self_link}"
|
||||
}
|
||||
|
||||
resource "google_compute_disk" "foobar" {
|
||||
name = "%s"
|
||||
image = "${data.google_compute_image.my_image.self_link}"
|
||||
size = 10
|
||||
type = "pd-ssd"
|
||||
zone = "us-central1-a"
|
||||
project = "${google_project.project.project_id}"
|
||||
|
||||
disk_encryption_key {
|
||||
kms_key_self_link = "${google_kms_crypto_key.my_crypto_key.self_link}"
|
||||
}
|
||||
|
||||
depends_on = [
|
||||
"google_kms_crypto_key_iam_binding.kms-key-binding",
|
||||
"google_project_iam_member.kms-project-binding",
|
||||
]
|
||||
}
|
||||
`, pid, pname, org, billing, keyRingName, keyName, diskName)
|
||||
}
|
||||
|
||||
func testAccComputeDisk_deleteDetach(instanceName, diskName string) string {
|
||||
return fmt.Sprintf(`
|
||||
data "google_compute_image" "my_image" {
|
||||
|
|
|
@ -511,30 +511,6 @@ func TestAccContainerCluster_withPrivateCluster(t *testing.T) {
|
|||
},
|
||||
})
|
||||
}
|
||||
|
||||
func TestAccContainerCluster_withPrivateClusterConfig(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
clusterName := fmt.Sprintf("cluster-test-%s", acctest.RandString(10))
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckContainerClusterDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: testAccContainerCluster_withPrivateClusterConfig(clusterName),
|
||||
},
|
||||
{
|
||||
ResourceName: "google_container_cluster.with_private_cluster",
|
||||
ImportStateIdPrefix: "us-central1-a/",
|
||||
ImportState: true,
|
||||
ImportStateVerify: true,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func TestAccContainerCluster_withLegacyAbac(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
@ -2500,53 +2476,6 @@ resource "google_container_cluster" "with_private_cluster" {
|
|||
}
|
||||
}`, clusterName, clusterName)
|
||||
}
|
||||
|
||||
func testAccContainerCluster_withPrivateClusterConfig(clusterName string) string {
|
||||
return fmt.Sprintf(`
|
||||
resource "google_compute_network" "container_network" {
|
||||
name = "container-net-%s"
|
||||
auto_create_subnetworks = false
|
||||
}
|
||||
|
||||
resource "google_compute_subnetwork" "container_subnetwork" {
|
||||
name = "${google_compute_network.container_network.name}"
|
||||
network = "${google_compute_network.container_network.name}"
|
||||
ip_cidr_range = "10.0.36.0/24"
|
||||
region = "us-central1"
|
||||
private_ip_google_access = true
|
||||
|
||||
secondary_ip_range {
|
||||
range_name = "pod"
|
||||
ip_cidr_range = "10.0.0.0/19"
|
||||
}
|
||||
|
||||
secondary_ip_range {
|
||||
range_name = "svc"
|
||||
ip_cidr_range = "10.0.32.0/22"
|
||||
}
|
||||
}
|
||||
|
||||
resource "google_container_cluster" "with_private_cluster" {
|
||||
name = "cluster-test-%s"
|
||||
zone = "us-central1-a"
|
||||
initial_node_count = 1
|
||||
|
||||
network = "${google_compute_network.container_network.name}"
|
||||
subnetwork = "${google_compute_subnetwork.container_subnetwork.name}"
|
||||
|
||||
private_cluster_config {
|
||||
enable_private_endpoint = true
|
||||
enable_private_nodes = true
|
||||
master_ipv4_cidr_block = "10.42.0.0/28"
|
||||
}
|
||||
master_authorized_networks_config { cidr_blocks = [] }
|
||||
ip_allocation_policy {
|
||||
cluster_secondary_range_name = "${google_compute_subnetwork.container_subnetwork.secondary_ip_range.0.range_name}"
|
||||
services_secondary_range_name = "${google_compute_subnetwork.container_subnetwork.secondary_ip_range.1.range_name}"
|
||||
}
|
||||
}`, clusterName, clusterName)
|
||||
}
|
||||
|
||||
func testAccContainerCluster_sharedVpc(org, billingId, projectName, name string) string {
|
||||
return fmt.Sprintf(`
|
||||
resource "google_project" "host_project" {
|
||||
|
|
Loading…
Reference in New Issue
Block a user