Skip to content

Commit bc18d40

Browse files
authored
Suppress instance profile skip_validation diff (#884)
* Fixed missing diff skip for `skip_validation` in `databricks_instance_profile`
1 parent 58d257b commit bc18d40

File tree

3 files changed

+34
-46
lines changed

3 files changed

+34
-46
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## 0.3.10
44

55
* Added `private_access_level` and `allowed_vpc_endpoint_ids` to `databricks_mws_private_access_settings` resource, which is also now updatable ([#867](https://github.com/databrickslabs/terraform-provider-databricks/issues/867)).
6+
* Fixed missing diff skip for `skip_validation` in `databricks_instance_profile` ([#860](https://github.com/databrickslabs/terraform-provider-databricks/issues/860)).
67

78
## 0.3.9
89

identity/resource_instance_profile.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,12 @@ func ResourceInstanceProfile() *schema.Resource {
138138
instanceProfileSchema := common.StructToSchema(InstanceProfileInfo{},
139139
func(m map[string]*schema.Schema) map[string]*schema.Schema {
140140
m["instance_profile_arn"].ValidateDiagFunc = ValidInstanceProfile
141+
m["skip_validation"].DiffSuppressFunc = func(k, old, new string, d *schema.ResourceData) bool {
142+
if old == "false" && new == "true" {
143+
return true
144+
}
145+
return false
146+
}
141147
return m
142148
})
143149
return common.Resource{

scripts/awsmt-integration/main.tf

Lines changed: 27 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -64,19 +64,38 @@ resource "databricks_mws_credentials" "this" {
6464
depends_on = [aws_iam_role_policy.this]
6565
}
6666

67-
module "this" {
68-
source = "../modules/aws-mws-common"
69-
cidr_block = local.cidr_block
70-
region = local.region
71-
prefix = local.prefix
72-
tags = local.tags
67+
resource "aws_s3_bucket" "root_storage_bucket" {
68+
bucket = "${local.prefix}-root-bucket"
69+
acl = "private"
70+
versioning {
71+
enabled = false
72+
}
73+
force_destroy = true
74+
tags = merge(local.tags, {
75+
Name = "${local.prefix}-root-bucket"
76+
})
77+
}
78+
79+
resource "aws_s3_bucket_public_access_block" "root_storage_bucket" {
80+
bucket = aws_s3_bucket.root_storage_bucket.id
81+
ignore_public_acls = true
82+
depends_on = [aws_s3_bucket.root_storage_bucket]
83+
}
84+
85+
data "databricks_aws_bucket_policy" "this" {
86+
bucket = aws_s3_bucket.root_storage_bucket.bucket
87+
}
88+
89+
resource "aws_s3_bucket_policy" "root_bucket_policy" {
90+
bucket = aws_s3_bucket.root_storage_bucket.id
91+
policy = data.databricks_aws_bucket_policy.this.json
7392
}
7493

7594
// register root bucket
7695
resource "databricks_mws_storage_configurations" "this" {
7796
provider = databricks.mws
7897
account_id = local.account_id
79-
bucket_name = module.this.root_bucket
98+
bucket_name = aws_s3_bucket.root_storage_bucket.bucket
8099
storage_configuration_name = "${local.prefix}-storage"
81100
}
82101

@@ -94,6 +113,7 @@ module "vpc" {
94113

95114
enable_dns_hostnames = true
96115
enable_nat_gateway = true
116+
single_nat_gateway = true
97117
create_igw = true
98118

99119
public_subnets = [cidrsubnet(local.cidr_block, 3, 0)]
@@ -113,45 +133,6 @@ module "vpc" {
113133
}]
114134
}
115135

116-
module "vpc_endpoints" {
117-
source = "terraform-aws-modules/vpc/aws//modules/vpc-endpoints"
118-
version = "3.2.0"
119-
120-
vpc_id = module.vpc.vpc_id
121-
security_group_ids = [module.vpc.default_security_group_id]
122-
123-
endpoints = {
124-
s3 = {
125-
service = "s3"
126-
service_type = "Gateway"
127-
route_table_ids = flatten([
128-
module.vpc.private_route_table_ids,
129-
module.vpc.public_route_table_ids])
130-
tags = {
131-
Name = "${local.prefix}-s3-vpc-endpoint"
132-
}
133-
},
134-
sts = {
135-
service = "sts"
136-
private_dns_enabled = true
137-
subnet_ids = module.vpc.private_subnets
138-
tags = {
139-
Name = "${local.prefix}-sts-vpc-endpoint"
140-
}
141-
},
142-
kinesis-streams = {
143-
service = "kinesis-streams"
144-
private_dns_enabled = true
145-
subnet_ids = module.vpc.private_subnets
146-
tags = {
147-
Name = "${local.prefix}-kinesis-vpc-endpoint"
148-
}
149-
},
150-
}
151-
152-
tags = local.tags
153-
}
154-
155136
resource "databricks_mws_networks" "this" {
156137
provider = databricks.mws
157138
account_id = local.account_id

0 commit comments

Comments
 (0)